﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace HeathCareSystem
{
    public class ThamSoDAO
    {
        DataProvider dp = new DataProvider();

        public bool ThemThamSo(ThamSoDTO ts){
            string strSQL = string.Format("INSERT INTO ThamSo (Ngay, FirstTime) " +
                                          "VALUES (CONVERT(DATETIME, '{0}', 102), '{1}')", ts.Ngay, ts.FirstTime);
            return dp.ExecuteNonQuery(strSQL);
        }

        
        public bool CapNhatThamSo(ThamSoDTO ts)
        {
            string strSQL = string.Format("UPDATE ThamSo "+
                                          "SET Ngay = CONVERT(DATETIME, '{0}', 102), FirstTime = '{1}'", ts.Ngay, ts.FirstTime);
            return dp.ExecuteNonQuery(strSQL);
        }

        public bool XoaThamSo(){
            string strSQL = string.Format(" DELETE FROM ThamSo");
            return dp.ExecuteNonQuery(strSQL);
        }
       
    }
}